MoreFun Device Properties Configuration
The MoreFun SmartPOS SDK allows you to configure various device properties directly from your application, including kiosk mode and permissions.
Configuration
Warning
- The device properties configuration must be called after initializing the SDK with
SDKPayments.init(). Attempting to configure properties before SDK initialization will result in a runtime exception. - During a transaction: You cannot configure device properties while a transaction is in progress. The configuration will return
SDKMoreFunPropertiesConfigurationResult.Fail.ReaderBusy. - During configuration: You cannot start a transaction while properties are being configured. The transaction creation will fail, and you will receive a
SDKTransactionIntentResult.Errorin theonTransactionCreated()callback with the message indicating that device properties are being configured. - Multiple configurations: Even though the configuration interface can hold multiple sets of properties, applying them simultaneously is not guaranteed to work correctly. You must perform separate
configurecalls sequentially. For instance, you should first configure Kiosk mode, and only upon its completion, proceed to configure the permissions.
Always ensure that no transaction is active before configuring properties, and wait for configuration to complete before starting a new transaction. :::
Basic Implementation
To configure MoreFun device properties, use the SDKMoreFunReader.configurator:
import com.geopagos.reader.morefun.SDKMoreFunPropertiesConfiguration
import com.geopagos.reader.morefun.SDKMoreFunPropertiesConfigurationResult
import com.geopagos.reader.morefun.SDKMoreFunReader
// Create the Map with configuration properties
val properties = mapOf(
"KIOSK_MODE_ENABLE" to true,
"KIOSK_MODE_PACKAGE" to "com.your.application",
"KIOSK_MODE_PASSWORD" to "your_password"
)
// Configure device properties
SDKMoreFunReader.configurator.configure(
SDKMoreFunPropertiesConfiguration(properties)
) { result ->
when (result) {
is SDKMoreFunPropertiesConfigurationResult.Success -> {
// Properties configured successfully
println("Device properties configured successfully")
}
is SDKMoreFunPropertiesConfigurationResult.Fail.ReaderBusy -> {
// The reader is currently busy with another operation
// This can happen if:
// - A transaction is in progress
// - Another configuration is being processed
// Wait and retry after the current operation completes
println("Reader is busy - retry later")
}
is SDKMoreFunPropertiesConfigurationResult.Fail.Error -> {
// An error occurred during configuration
// This can happen if:
// - Invalid properties were provided
// - Device communication failed
// - Insufficient permissions
println("Error configuring device properties")
}
}
}
Configuration Results
The configure method returns one of three possible results through the callback:
Success
SDKMoreFunPropertiesConfigurationResult.Success
The device properties configuration was applied successfully. The device is now configured with the provided properties.
Reader Busy
SDKMoreFunPropertiesConfigurationResult.Fail.ReaderBusy
The reader is currently busy and cannot process the configuration. This happens when:
- A transaction is in progress: Wait for the transaction to complete before configuring properties
- Another configuration is being processed: Wait for the current configuration to finish
Error
SDKMoreFunPropertiesConfigurationResult.Fail.Error
An error occurred during the configuration process. Possible causes:
- Invalid properties in the Bundle
- Device communication failure
- Insufficient permissions on the device
- Incorrect values for the properties
Common Use Cases
Kiosk Mode Configuration
Enable kiosk mode to lock the device to your application:
val kioskProperties = mapOf(
"KIOSK_MODE_ENABLE" to true,
"KIOSK_MODE_PACKAGE" to "com.your.application",
"KIOSK_MODE_PASSWORD" to "your_password"
)
SDKMoreFunReader.configurator.configure(
SDKMoreFunPropertiesConfiguration(kioskProperties)
) { result ->
// Handle result
}
Disabling Kiosk Mode
To disable kiosk mode:
val properties = mapOf(
"KIOSK_MODE_DISABLE" to true,
"KIOSK_MODE_PACKAGE" to "com.your.application"
)
SDKMoreFunReader.configurator.configure(
SDKMoreFunPropertiesConfiguration(properties)
) { result ->
// Handle result
}
Granting Permissions
You can optionally grant permissions to your application:
val permissions = arrayOf(
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.WRITE_EXTERNAL_STORAGE
)
val properties = mapOf(
"GRANT_PERMISSION" to true,
"GRANT_PERMISSION_PACKAGENAME" to "com.your.application",
"GRANT_PERMISSION_PERMISSIONLIST" to permissions
)
SDKMoreFunReader.configurator.configure(
SDKMoreFunPropertiesConfiguration(properties)
) { result ->
// Handle result
}
Available Properties
The configuration Map accepts any property supported by the MoreFun YSDK. Below are the commonly used properties:
Kiosk Mode Properties
| Property | Type | Description |
|---|---|---|
KIOSK_MODE_ENABLE | Boolean | Enables kiosk mode |
KIOSK_MODE_DISABLE | Boolean | Disables kiosk mode |
KIOSK_MODE_PACKAGE | String | Application package name |
KIOSK_MODE_PASSWORD | String | Password to exit kiosk mode |
Optional Permission Properties
| Property | Type | Description |
|---|---|---|
GRANT_PERMISSION | Boolean | Enable permission granting |
GRANT_PERMISSION_PACKAGENAME | String | Package name to grant permissions to |
GRANT_PERMISSION_PERMISSIONLIST | String[] | Array of permissions to grant |